<template>
  <div>
    <div style="text-align: center;margin-bottom: 20px;">
      <!-- <p v-if="isenter">注：要求彩色原件或加盖公章的复印件照片，支持图片格式JPG、PNG，且每个文件大小不超过{{imageSize}}M</p> -->
      <p>注：以下除经营场所照片外，均需加盖公章，格式支持格式JPG、PNG、PDF</p>
    </div>
    <a-form @submit="handleSubmit" style="width:60%;margin:0px auto;" :form="form">
      <a-row class="row-sty">
        <a-col :xs="{ span : 24 }" :sm="{ span:9 }" class="formGroupTitle">商户资料</a-col>
        <a-col :xs="{ span : 24 }" :sm="{ span:12,offset:1 }"></a-col>
      </a-row>

      <a-form-item v-bind="formItemLayout" label="营业执照">
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload',{rules: [{ required: true, message: '请上传营业执照!' }]}]"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList"
            :data="{to}"
            @preview="handlePreview"
            @change="handleChange"
          >
            <div v-if="fileList.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">营业执照</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
            <img alt="example" style="width: 100%" :src="previewImage" />
          </a-modal>
        </div>
      </a-form-item>

      <!-- <div style="display:flex;"> -->
      <a-form-item v-bind="formItemLayout" label="法定代表人身份证">
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload2',{rules: [{ required: true, message: '请上传身份证正/反面!' }]}]"
            action="/file/file/upload"
            listType="picture-card"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            :fileList="fileList2"
            @preview="handlePreview2"
            @change="handleChange2"
          >
            <div v-if="fileList2.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">人像面</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible2" :footer="null" @cancel="handleCancel2">
            <img alt="example" style="width: 100%" :src="previewImage2" />
          </a-modal>
        </div>
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList3"
            @preview="handlePreview3"
            @change="handleChange3"
          >
            <div v-if="fileList3.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">国徽面</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible3" :footer="null" @cancel="handleCancel3">
            <img alt="example" style="width: 100%" :src="previewImage3" />
          </a-modal>
        </div>
      </a-form-item>

      <a-form-item v-if="isenter" v-bind="formItemLayout" label="结算银行账户">
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload4',{rules: [{ required: true, message: '请上传账户证明!' }]}]"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList4"
            @preview="handlePreview4"
            @change="handleChange4"
          >
            <div v-if="fileList4.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">账户证明</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible4" :footer="null" @cancel="handleCancel4">
            <img alt="example" style="width: 100%" :src="previewImage4" />
          </a-modal>
        </div>
      </a-form-item>

      <a-form-item v-if="!isenter" v-bind="formItemLayout" label="结算银行账户">
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload5',{rules: [{ required: true, message: '请上传银行卡正面!' }]}]"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList5"
            @preview="handlePreview5"
            @change="handleChange5"
          >
            <div v-if="fileList5.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">银行卡正面</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible5" :footer="null" @cancel="handleCancel5">
            <img alt="example" style="width: 100%" :src="previewImage5" />
          </a-modal>
        </div>
        <p
                style="font-size: 12px;line-height: 30px;"
              >为了您的资金安全，请勿上传带有CVV安全码的照片</p>
      </a-form-item>

      <a-form-item v-bind="formItemLayout" label="经营场所照片">
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload7',{rules: [{ required: true, message: '请上传经营场所照片!' }]}]"
            action="/file/file/upload"
            listType="picture-card"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            :fileList="fileList7"
            @preview="handlePreview7"
            @change="handleChange7"
          >
            <div v-if="fileList7.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">门头/LOGO</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible7" :footer="null" @cancel="handleCancel7">
            <img alt="example" style="width: 100%" :src="previewImage7" />
          </a-modal>
        </div>
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList8"
            @preview="handlePreview8"
            @change="handleChange8"
          >
            <div v-if="fileList8.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">前台/收银台</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible8" :footer="null" @cancel="handleCancel8">
            <img alt="example" style="width: 100%" :src="previewImage8" />
          </a-modal>
        </div>
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList9"
            @preview="handlePreview9"
            @change="handleChange9"
          >
            <div v-if="fileList9.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">办公/营业</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible9" :footer="null" @cancel="handleCancel9">
            <img alt="example" style="width: 100%" :src="previewImage9" />
          </a-modal>
        </div>
      </a-form-item>

      <!-- <a-row style='display: flex;flex-direction: row;'> -->
      <a-form-item v-bind="formItemLayout" label="上传协议">
        <div class="clearfix" style="display: flex;flex-direction: column;">
          <a-upload
            v-decorator="['upload10',{rules: [{ required: true, message: '请上传特约商户协议书!' }]}]"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList10"
            :data="{to}"
            @preview="handlePreview10"
            @change="handleChange10"
          >
            <div v-if="fileList10.length < 3">
              <a-icon type="plus" />
              <div class="ant-upload-text">特约商户协议书</div>
            </div>
          </a-upload>
          <span style="font-size: 14px;">
            点击下载
            <a
              href="javascript:false;void(0);"
              @click="getFileDownload('merchant_service')"
            >特约商户服务协议</a>
          </span>
          <a-modal :visible="previewVisible10" :footer="null" @cancel="handleCancel10">
            <img alt="example" style="width: 100%" :src="previewImage10" />
          </a-modal>
        </div>
      </a-form-item>

      <a-form-item style="margin-bottom: 0;" v-bind="formItemLayout" label="委托入款证明" help>
        <!-- <a-form-item label=""> -->
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            v-decorator="['upload11',{rules: []}]"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList11"
            :data="{to}"
            @preview="handlePreview11"
            @change="handleChange11"
          >
            <div v-if="fileList11.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">委托入款授权书</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible11" :footer="null" @cancel="handleCancel11">
            <img alt="example" style="width: 100%" :src="previewImage11" />
          </a-modal>
        </div>
      </a-form-item>
      <a-row style="margin-bottom: 20px;">
        <a-col :xs="{ span : 24 }" :sm="{ span:9 }" class="formGroupTitle"></a-col>
        <a-col :xs="{ span : 24 }" :sm="{ span:12,offset:1 }">
          <p style="font-size:12px;">
            当出现以下情况，需提供
            <a
              class="a-sty"
              style="color:#1478d5;"
              @click="getFileDownload('entrust_income_auth')"
            >委托入款授权书</a>
          </p>
          <p>1、企业，结算银行账户类型为“对私”时</p>
          <p>2、个体工商户，结算银行账户所属为”非法人“时</p>
        </a-col>
      </a-row>
      <!-- </a-row> -->

      <!-- 关系证明 -->
      <a-form-item v-bind="formItemLayout" label="关系证明">
        <div class="clearfix" style="display:inline-block;">
          <!-- <a-upload v-decorator="['upload16',{rules: [{ required: true, message: '请上传银行卡正/反面!' }]}]" -->
          <a-upload
            v-decorator="['upload16']"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList16"
            @preview="handlePreview16"
            @change="handleChange16"
          >
            <div v-if="fileList16.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">亲属关系证明</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible16" :footer="null" @cancel="handleCancel16">
            <img alt="example" style="width: 100%" :src="previewImage16" />
          </a-modal>
        </div>
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList17"
            @preview="handlePreview17"
            @change="handleChange17"
          >
            <div v-if="fileList17.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">手持身份证合照</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible17" :footer="null" @cancel="handleCancel17">
            <img alt="example" style="width: 100%" :src="previewImage17" />
          </a-modal>
        </div>
        <p style="font-size: 12px;margin:0;line-height: 30px;">个体工商户，当结算银行账户所属为“非法人”时，需提供以下材料：</p>
        <p style="font-size: 12px;margin:0;line-height: 30px;">1、入账双方亲属关系证明，如户口簿、结婚证照片</p>
        <p style="font-size: 12px;margin:0;line-height: 30px;">2、入账双方手持各自身份证合照</p>
      </a-form-item>

      <!-- 持卡人身份证 -->
      <a-form-item v-bind="formItemLayout" label="持卡人身份证">
        <div class="clearfix" style="display:inline-block;">
          <!-- <a-upload v-decorator="['upload18',{rules: [{ required: true, message: '请上传银行卡正/反面!' }]}]" -->
          <a-upload
            v-decorator="['upload18']"
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList18"
            @preview="handlePreview18"
            @change="handleChange18"
          >
            <div v-if="fileList18.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">人像面</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible18" :footer="null" @cancel="handleCancel18">
            <img alt="example" style="width: 100%" :src="previewImage18" />
          </a-modal>
        </div>
        <div class="clearfix" style="display:inline-block;">
          <a-upload
            :data="{to}"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList19"
            @preview="handlePreview19"
            @change="handleChange19"
          >
            <div v-if="fileList19.length < 1">
              <a-icon type="plus" />
              <div class="ant-upload-text">国徽面</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible19" :footer="null" @cancel="handleCancel19">
            <img alt="example" style="width: 100%" :src="previewImage19" />
          </a-modal>
        </div>
        <p
          style="font-size: 12px;margin:0;line-height: 30px;"
        >企业、个体工商户，当结算银行账户所属为“非法人”时，需提供持卡人身份证正面和背面照片</p>
      </a-form-item>

      <!-- 其他材料 -->

      <a-form-item v-bind="formItemLayout" label="其他材料">
        <div class="clearfix">
          <a-upload
            v-decorator="['upload12']"
            name="upfile"
            :headers="henderstoken"
            action="/file/file/upload"
            listType="picture-card"
            :fileList="fileList12"
            :data="{to}"
            @preview="handlePreview12"
            @change="handleChange12"
          >
            <div v-if="fileList12.length < 3">
              <a-icon type="plus" />
              <div class="ant-upload-text">其他材料</div>
            </div>
          </a-upload>
          <a-modal :visible="previewVisible12" :footer="null" @cancel="handleCancel12">
            <img alt="example" style="width: 100%" :src="previewImage12" />
          </a-modal>
        </div>
      </a-form-item>

      <!-- 授权办理人 -->
      <!-- <a-row class="row-sty">
                <a-col :xs="{ span : 24 }" :sm="{ span:9 }" class="formGroupTitle">授权办理人</a-col>
                <a-col :xs="{ span : 24 }" :sm="{ span:12,offset:1 }">
                    <p style="font-size:12px;">
                        非法定代表人本人申请，请填写授办理人信息，并提供
                        <a class="a-sty" style="color:#1478d5;" href="static/授权委托书.docx" download="授权委托书.docx"
                            target="_blank">授权委托书</a>
                    </p>
                </a-col>
            </a-row>
            <a-form-item v-bind="formItemLayout" label="姓名">
                <a-input style="width:80%;" v-decorator="[
                        'identityName',
                        {rules: [{ required: false, message: '请输入姓名' }]}
                      ]" placeholder="请输入授权办理人姓名" />
            </a-form-item>

            <a-form-item v-bind="formItemLayout" label="证件类型">
                <div>
                    <a-select style="width:80%;" disabled v-decorator="[
                        'codetype',
                        {rules: [{ required: false, message: '请选择证件类型' }],initialValue: 'legal'}
                      ]">
                        <a-select-option value="legal">身份证</a-select-option>
                        <a-select-option value="lucy">护照</a-select-option>
                        <a-select-option value="disabled">港澳台通行证</a-select-option>
                        <a-select-option value="Yiminghe">军官证</a-select-option>
                        <a-select-option value="Yiminghe">户口簿</a-select-option>
                    </a-select>
                </div>
            </a-form-item>

            <a-form-item v-bind="formItemLayout" label="证件号码" help="证件号码末位为X的用大写X代替">
                <a-input style="width:80%;" v-decorator="[
                        'identityNo',
                        {rules: [{ required: false, message: '请输入证件号码' },{
                           validator: validateIdentityNo
                         }],validateTrigger: 'blur'}
                      ]" placeholder="请输入证件号码" />
            </a-form-item>

            <a-form-item v-bind="formItemLayout" label="证件有效期">
                <a-date-picker :disabledDate="disabledDate" placeholder="请选择证件有效期" @change="dateChange" v-decorator="[
                        'expiryDate',
                        {rules: [{ required: false, message: '请选择证件有效期' }]}
                      ]" :format="dateFormat" />
            </a-form-item>
      上传证件-->
      <!-- <a-form-item v-bind="formItemLayout" label="上传资料" :help="`支持图片格式JPG、PNG，且每个文件大小不超过${imageSize}M`">
                <div class="clearfix" style="display:inline-block;">
                    <a-upload v-decorator="['upload13',{rules: [{ required: false, message: '请上传身份证正/反面!' }]}]"
                        action="/file/file/upload" listType="picture-card" :data="{to}" name="upfile" :headers="henderstoken"
                        :fileList="fileList13" @preview="handlePreview13" @change="handleChange13">
                        <div v-if="fileList13.length < 1">
                            <a-icon type="plus" />
                            <div class="ant-upload-text">身份证正面</div>
                        </div>
                    </a-upload>
                    <a-modal :visible="previewVisible13" :footer="null" @cancel="handleCancel13">
                        <img alt="example" style="width: 100%" :src="previewImage13">
                    </a-modal>
                </div>
                <div class="clearfix" style="display:inline-block;">
                    <a-upload :data="{to}" name="upfile" action="/file/file/upload" listType="picture-card"
                        :fileList="fileList14" @preview="handlePreview14" @change="handleChange14">
                        <div v-if="fileList14.length < 1">
                            <a-icon type="plus" />
                            <div class="ant-upload-text">身份证反面</div>
                        </div>
                    </a-upload>
                    <a-modal :visible="previewVisible14" :footer="null" @cancel="handleCancel14">
                        <img alt="example" style="width: 100%" :src="previewImage14">
                    </a-modal>
                </div>
                <div class="clearfix" style="display:inline-block;">
                    <a-upload :data="{to}" name="upfile" :headers="henderstoken" action="/file/file/upload" listType="picture-card"
                        :fileList="fileList15" @preview="handlePreview15" @change="handleChange15">
                        <div v-if="fileList15.length < 1">
                            <a-icon type="plus" />
                            <div class="ant-upload-text">授权委托书</div>
                        </div>
                    </a-upload>
                    <a-modal :visible="previewVisible15" :footer="null" @cancel="handleCancel15">
                        <img alt="example" style="width: 100%" :src="previewImage15">
                    </a-modal>
                </div>
      </a-form-item>-->
      <a-row>
        <a-col :xs="{ span : 24 }" :sm="{ span:12,offset:10 }">
          <a-button class="submitButton" html-type="submit" type="primary" :loading="loading">下一步</a-button>
        </a-col>
      </a-row>
    </a-form>
  </div>
</template>
<script>
import { mapState, mapMutations, mapAction } from "vuex";
import api from "@/common/api";
import moment from "moment";
function getBase64(img, callback) {
  const reader = new FileReader();
  reader.addEventListener("load", () => callback(reader.result));
  reader.readAsDataURL(img);
}
export default {
  data() {
    return {
      dateFormat: "YYYY-MM-DD",
      loading: false,
      isenter: true,
      modify: "",
      henderstoken: {
        Authorization: localStorage.getItem("token"),
      },
      to:sessionStorage.getItem("orgAMemberNo")+"_"+sessionStorage.getItem("orgAMerchantName"),
      form: this.$form.createForm(this),
      previewVisible: false,
      previewVisible2: false,
      previewVisible3: false,
      previewVisible4: false,
      previewVisible5: false,
      previewVisible6: false,
      previewVisible7: false,
      previewVisible8: false,
      previewVisible9: false,
      previewVisible10: false,
      previewVisible11: false,
      previewVisible12: false,
      previewVisible13: false,
      previewVisible14: false,
      previewVisible15: false,
      previewVisible16: false,
      previewVisible17: false,
      previewVisible18: false,
      previewVisible19: false,
      previewImage: "",
      previewImage2: "",
      previewImage3: "",
      previewImage4: "",
      previewImage5: "",
      previewImage6: "",
      previewImage7: "",
      previewImage8: "",
      previewImage9: "",
      previewImage10: "",
      previewImage11: "",
      previewImage12: "",
      previewImage13: "",
      previewImage14: "",
      previewImage15: "",
      previewImage16: "",
      previewImage17: "",
      previewImage18: "",
      previewImage19: "",
      fileList: [],
      fileList2: [],
      fileList3: [],
      fileList4: [],
      fileList5: [],
      fileList6: [],
      fileList7: [],
      fileList8: [],
      fileList9: [],
      fileList10: [],
      fileList11: [],
      fileList12: [],
      fileList13: [],
      fileList14: [],
      fileList15: [],
      fileList16: [],
      fileList17: [],
      fileList18: [],
      fileList19: [],
      picdata: "",
      picdata2: "",
      picdata3: "",
      picdata4: "",
      picdata5: "",
      picdata6: "",
      imageUrl: "",
      imageUrl2: "",
      merchantType: "", //客户类型
      uploadImg: {
        logBankCard: {
          id: "",
          isPrivate: Boolean,
          imgCardno: null,
        },
        logMerchantPospUpdateRequest: {
          memberNo: "",
          id: "",
          image: "",
          publicAccount: "",
          doorImg: "",
          deskImg: "",
          officeImg: "",
          entrustRecharImg: "",
          merchantProtocolImgs: [],
          otherImgs: [],
          kinshipCertificateImg: "",
          handCardImg: "",
          legalPersonAccount: false, //是否是法人
          merchantType: "",
        },
        cardHolderIdentity: {
          id: "",
          imgHead: "",
          imgEmblem: "",
        },
        legalLogIdentity: {
          id: "",
          imgHead: "",
          imgEmblem: "",
        },
        // authLogIdentity: {
        //     identityName: "",
        //     identityNo: "",
        //     expiryDate: "",
        //     imgHead: "",
        //     imgEmblem: "",
        //     imgExt1: ""
        // }
      },
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 9 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 12, offset: 1 },
          md: { span: 10, offset: 1 },
        },
      },
    };
  },
  computed: {
    ...mapState({
      imageSize: (state) => state.imageSize,
    }),
  },
  created() {
    console.log(this.$route.query.modify);
    if (this.$route.query.modify) {
      console.log("修改");
      this.OrgpicDataModify();
    } else {
      console.log("222");
    }
    this.getExistData();
  },
  methods: {
    moment,
    //日期不可选
    disabledDate(current) {
      // Can not select days before today and today
      return current && current < moment().endOf("day");
    },
    dateChange(date, dateString) {
      console.log("dateString", dateString);
      this.uploadImg.authLogIdentity.expiryDate = dateString;
    },
    getExistData() {
      this.uploadImg.logMerchantPospUpdateRequest.memberNo = sessionStorage.getItem(
        "orgAMemberNo"
      );
      this.$axios
        .get(
          "/agent/merchant/network/fetch/step2/" +
            sessionStorage.getItem("orgAMemberNo")
        )
        .then(
          (res) => {
            console.log("res", res);
            if (res.data.code == "OK") {
              this.modify = res.data.data;
              this.to = this.modify.merchantPosp.memberNo + '_' + this.modify.merchantPosp.merchantName
              this.merchantType = this.modify.merchantPosp.merchantType;
              // this.uploadImg.logMerchantPospUpdateRequest = this.modify.merchantPosp;
              this.uploadImg.logMerchantPospUpdateRequest.memberNo = this.modify.merchantPosp.memberNo;
              this.uploadImg.logMerchantPospUpdateRequest.deskImg = this.modify.merchantPosp.deskImg;
              this.uploadImg.logMerchantPospUpdateRequest.doorImg = this.modify.merchantPosp.doorImg;
              this.uploadImg.logMerchantPospUpdateRequest.entrustRecharImg = this.modify.merchantPosp.entrustRecharImg;
              this.uploadImg.logMerchantPospUpdateRequest.image = this.modify.merchantPosp.image;
              this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs = this
                .modify.merchantPosp.merchantProtocolImgs
                ? this.modify.merchantPosp.merchantProtocolImgs
                : [];
              this.uploadImg.logMerchantPospUpdateRequest.officeImg = this.modify.merchantPosp.officeImg;
              this.uploadImg.logMerchantPospUpdateRequest.publicAccount = this.modify.merchantPosp.publicAccount;
              this.uploadImg.logMerchantPospUpdateRequest.otherImgs = this
                .modify.merchantPosp.otherImgs
                ? this.modify.merchantPosp.otherImgs
                : [];
              this.uploadImg.logMerchantPospUpdateRequest.legalPersonAccount =
                this.modify.merchantPosp.legalPersonAccount == null
                  ? true
                  : this.modify.merchantPosp.legalPersonAccount;
              this.uploadImg.logMerchantPospUpdateRequest.merchantType = this.modify.merchantPosp.merchantType;
              this.uploadImg.logMerchantPospUpdateRequest.kinshipCertificateImg = this.modify.merchantPosp.kinshipCertificateImg;
              this.uploadImg.logMerchantPospUpdateRequest.handCardImg = this.modify.merchantPosp.handCardImg;

              // this.uploadImg.logBankCard = this.modify.bankCard
              this.uploadImg.logBankCard.isPrivate = this.modify.bankCard.isPrivate;
              this.uploadImg.logBankCard.imgCardno = this.modify.bankCard.imgCardno;
              this.uploadImg.legalLogIdentity.imgEmblem = this.modify.identityLegal.imgEmblem;
              this.uploadImg.legalLogIdentity.imgHead = this.modify.identityLegal.imgHead;
              this.uploadImg.cardHolderIdentity.imgEmblem = this.modify
                .cardholder
                ? this.modify.cardholder.imgEmblem
                : "";
              this.uploadImg.cardHolderIdentity.imgHead = this.modify.cardholder
                ? this.modify.cardholder.imgHead
                : "";

              this.form.setFieldsValue({
                upload: this.modify.merchantPosp.image,
                upload2: this.modify.identityLegal.imgHead,
                upload4: this.modify.merchantPosp.publicAccount,
                upload7: this.modify.merchantPosp.doorImg,
                upload10: this.modify.merchantPosp.merchantProtocolImgs,
                upload11: this.modify.merchantPosp.entrustRecharImg,
                upload12: this.modify.merchantPosp.otherImgs,
              });
              // 对公对私判断
              if (res.data.data.bankCard.isPrivate) {
                this.uploadImg.logBankCard.isPrivate = true;
                this.isenter = false;
                console.log(
                  "this.modify.bankCard.imgCardno",
                  this.modify.bankCard.imgCardno
                );
                if (this.modify.bankCard.imgCardno) {
                  this.$nextTick(() => {
                    this.form.setFieldsValue({
                      upload5: this.modify.bankCard.imgCardno,
                    });
                  });
                }
              } else {
                this.uploadImg.logBankCard.isPrivate = false;
                this.isenter = true;
                if (this.modify.merchantPosp.publicAccount) {
                  this.$nextTick(() => {
                    this.form.setFieldsValue({
                      upload4: this.modify.merchantPosp.publicAccount,
                    });
                  });
                }
              }
              if (this.uploadImg.logMerchantPospUpdateRequest.image) {
                this.fileList = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest.image,
                  },
                ];
                this.fileList2 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.legalLogIdentity.imgHead,
                  },
                ];
                this.fileList3 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.legalLogIdentity.imgEmblem,
                  },
                ];
                if (this.uploadImg.logMerchantPospUpdateRequest.publicAccount) {
                  this.fileList4 = [
                    {
                      uid: Math.random(10000),
                      name: "xxx.png",
                      status: "done",
                      url:
                        "/file/file/download/" +
                        this.uploadImg.logMerchantPospUpdateRequest
                          .publicAccount,
                    },
                  ];
                }
                if (this.uploadImg.logBankCard.imgCardno) {
                  this.fileList5 = [
                    {
                      uid: Math.random(10000),
                      name: "xxx.png",
                      status: "done",
                      url:
                        "/file/file/download/" +
                        this.uploadImg.logBankCard.imgCardno,
                    },
                  ];
                }
                

                this.fileList7 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest.doorImg,
                  },
                ];
                this.fileList8 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest.deskImg,
                  },
                ];
                this.fileList9 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest.officeImg,
                  },
                ];

                // 上传协议 多张图片
                this.fileList10 = [
                  // {
                  //     uid: Math.random(10000),
                  //     name: "xxx.png",
                  //     status: "done",
                  //     url: "/file/file/download/" + this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImg
                  // }
                ];
                if (
                  this.uploadImg.logMerchantPospUpdateRequest
                    .merchantProtocolImgs
                ) {
                  this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs.forEach(
                    (item) => {
                      let Item = {
                        uid: Math.random(10000),
                        name: "xxx.png",
                        status: "done",
                        url: "/file/file/download/" + item,
                      };
                      this.fileList10.push(Item);
                    }
                  );
                }
              }

              if (
                this.uploadImg.logMerchantPospUpdateRequest.entrustRecharImg
              ) {
                this.fileList11 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest
                        .entrustRecharImg,
                  },
                ];
              }

              //关系证明照片 数据回显
              if (this.uploadImg.logMerchantPospUpdateRequest.handCardImg) {
                this.fileList17 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest.handCardImg,
                  },
                ];
              }
              if (
                this.uploadImg.logMerchantPospUpdateRequest
                  .kinshipCertificateImg
              ) {
                this.fileList16 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.logMerchantPospUpdateRequest
                        .kinshipCertificateImg,
                  },
                ];
              }

              //持卡人身份证照片 数据回显
              if (this.uploadImg.cardHolderIdentity.imgHead) {
                this.fileList18 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.cardHolderIdentity.imgHead,
                  },
                ];
              }
              if (this.uploadImg.cardHolderIdentity.imgEmblem) {
                this.fileList19 = [
                  {
                    uid: Math.random(10000),
                    name: "xxx.png",
                    status: "done",
                    url:
                      "/file/file/download/" +
                      this.uploadImg.cardHolderIdentity.imgEmblem,
                  },
                ];
              }

              this.fileList12 = [];
              if (this.uploadImg.logMerchantPospUpdateRequest.otherImgs) {
                this.uploadImg.logMerchantPospUpdateRequest.otherImgs.forEach(
                  (item) => {
                    let Item = {
                      uid: Math.random(10000),
                      name: "xxx.png",
                      status: "done",
                      url: "/file/file/download/" + item,
                    };
                    this.fileList12.push(Item);
                  }
                );
              }
              //有授权办理人信息
              // if (this.modify.identityAuth) {
              //     this.uploadImg.authLogIdentity.imgEmblem = this.modify.identityAuth.imgEmblem;
              //     this.uploadImg.authLogIdentity.imgExt1 = this.modify.identityAuth.imgExt1;
              //     this.uploadImg.authLogIdentity.imgHead = this.modify.identityAuth.imgHead;
              //     this.uploadImg.authLogIdentity.identityNo = this.modify.identityAuth.identityNo;
              //     this.uploadImg.authLogIdentity.identityName = this.modify.identityAuth.identityName;
              //     this.uploadImg.authLogIdentity.expiryDate = this.modify.identityAuth.expiryDate;
              //     this.form.setFieldsValue({
              //         identityNo: this.uploadImg.authLogIdentity.identityNo,
              //         identityName: this.uploadImg.authLogIdentity.identityName,
              //         expiryDate: moment(this.uploadImg.authLogIdentity.expiryDate),
              //     })
              //     this.fileList13 = [
              //         {
              //             uid: Math.random(10000),
              //             name: "xxx.png",
              //             status: "done",
              //             url: "/file/file/download/" + this.uploadImg.authLogIdentity.imgHead
              //         }
              //     ];
              //     this.fileList14 = [
              //         {
              //             uid: Math.random(10000),
              //             name: "xxx.png",
              //             status: "done",
              //             url: "/file/file/download/" + this.uploadImg.authLogIdentity.imgEmblem
              //         }
              //     ];
              //     this.fileList15 = [
              //         {
              //             uid: Math.random(10000),
              //             name: "xxx.png",
              //             status: "done",
              //             url: "/file/file/download/" + this.uploadImg.authLogIdentity.imgExt1
              //         }
              //     ];
              // }
            } else {
              this.$message.error("获取商户数据失败，请从商户审核查询界面点击继续填写。");
            }
          },
          (err) => {}
        );
    },
    handleSubmit(e) {
      console.log("点击了提交");
      this.form.setFieldsValue({
        upload4: this.modify.merchantPosp.publicAccount
          ? this.modify.merchantPosp.publicAccount
          : "  ",
      });
      e.preventDefault();
      this.form.validateFields((err, values) => {
        if (!err) {
          console.log("values", values);
          // if (values.identityName || values.identityNo || values.expiryDate || this.fileList13.length != 0 || this.fileList14.length != 0 || this.fileList15.length != 0) {
          //     if (!values.identityName || !values.identityNo || !values.expiryDate || this.fileList13.length == 0 || this.fileList14.length == 0 || this.fileList15.length == 0) {
          //         this.$message.warning("请填写完整授权办理人信息！");
          //         return false
          //     }
          // }
          //企业，“对私”时  个体工商户，“非法人”时
          if (
            (this.uploadImg.logBankCard.isPrivate &&
              this.merchantType == "org") ||
            (this.merchantType == "mer" &&
              !this.uploadImg.logMerchantPospUpdateRequest.legalPersonAccount)
          ) {
            if (this.fileList11.length == 0) {
              this.$message.warning("请上传委托入款证明！");
              return false;
            }
          }
          //个体工商户 非法人
          if (
            this.merchantType == "mer" &&
            !this.uploadImg.logMerchantPospUpdateRequest.legalPersonAccount
          ) {
            if (this.fileList16.length == 0 || this.fileList17.length == 0) {
              this.$message.warning("请上传关系证明图片！");
              return false;
            }
          }
          //企业，为“对私”，为“非法人”时   个体工商户，为“非法人”时
          if (
            (this.merchantType == "org" &&
              this.uploadImg.logBankCard.isPrivate &&
              !this.uploadImg.logMerchantPospUpdateRequest
                .legalPersonAccount) ||
            (this.merchantType == "mer" &&
              !this.uploadImg.logMerchantPospUpdateRequest.legalPersonAccount)
          ) {
            if (this.fileList18.length == 0 || this.fileList19.length == 0) {
              this.$message.warning("请上传持卡人身份证图片！");
              return false;
            }
          }

          //处理其他图片
          this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs = [];
          if (values.upload10) {
            let otherImgList = values.upload10.fileList || values.upload10;
            console.log("otherImgList", otherImgList);
            otherImgList.forEach((item) => {
              if (item.response) {
                this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs.push(
                  item.response.data
                );
              } else if (item.url) {
                let list = item.url.split("/");
                console.log(list, list[list.length - 1]);
                this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs.push(
                  list[list.length - 1]
                );
              } else {
                this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs.push(
                  item
                );
              }
            });
          }

          //处理其他图片
          this.uploadImg.logMerchantPospUpdateRequest.otherImgs = [];
          if (values.upload12) {
            let otherImgList = values.upload12.fileList || values.upload12;
            console.log("otherImgList", otherImgList);
            otherImgList.forEach((item) => {
              if (item.response) {
                this.uploadImg.logMerchantPospUpdateRequest.otherImgs.push(
                  item.response.data
                );
              } else if (item.url) {
                let list = item.url.split("/");
                console.log(list, list[list.length - 1]);
                this.uploadImg.logMerchantPospUpdateRequest.otherImgs.push(
                  list[list.length - 1]
                );
              } else {
                this.uploadImg.logMerchantPospUpdateRequest.otherImgs.push(
                  item
                );
              }
            });
          }
          // this.uploadImg.authLogIdentity.identityName = values.identityName ? values.identityName : '';
          // this.uploadImg.authLogIdentity.identityNo = values.identityNo ? values.identityNo : '';
          // this.uploadImg.authLogIdentity.id = this.modify.identityAuth ? this.modify.identityAuth.id : '';
          this.uploadImg.logBankCard.id = this.modify.bankCard.id;
          this.uploadImg.logMerchantPospUpdateRequest.id = this.modify.merchantPosp.id;
          this.uploadImg.legalLogIdentity.id = this.modify.identityLegal.id;
          this.uploadImg.cardHolderIdentity.id = this.modify.cardholder
            ? this.modify.cardholder.id
            : "";
          // if (this.uploadImg.authLogIdentity.identityName == '') {
          //     this.uploadImg.authLogIdentity = null;
          // }
          console.log("this.uploadImg", this.uploadImg);
          if (this.fileList.length == 0) {
            console.log("请上传营业执照照片");
            this.$message.error("请上传营业执照照片");
            return false;
          }
          if (this.fileList2.length == 0) {
            console.log("请上传身份证正面照片");
            this.$message.error("请上传身份证正面照片");
            return false;
          }
          if (this.fileList3.length == 0) {
            console.log("请上传身份证反面照片");
            this.$message.error("请上传身份证反面照片");
            return false;
          }
          if (this.isenter && this.fileList4.length == 0) {
            console.log("请上传对公账户证明照片");
            this.$message.error("请上传对公账户证明照片");
            return false;
          }
          if (!this.isenter && this.fileList5.length == 0) {
            this.$message.error("请上传银行卡正面照片");
            return false;
          }
          
          this.loading = true;

          const data = this.uploadImg;
          api.OrgDatasave(
            data,
            (res) => {
              console.log("res", res);
              if (res.code == "OK") {
                sessionStorage.setItem("identityimgHead", this.uploadImg.legalLogIdentity.imgHead);
                sessionStorage.setItem("identityimgEmblem", this.uploadImg.legalLogIdentity.imgEmblem);
                //this.loading = true;
                this.loading = false;
                this.doNext(2);
              } else {
                this.loading = false;
                this.$message.warning(res.message);
                console.log(res.code);
              }
            },
            (err) => {
              this.loading = false;
              console.log(err);
            }
          );
        }
      });
    },
    // 营业执照图片
    handleChange({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.image =
              obj.response.data;
          }
        }
      }
    },
    handleChange2({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList2 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.legalLogIdentity.imgHead = obj.response.data;
          }
        }
      }
    },
    handleChange3({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList3 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.legalLogIdentity.imgEmblem = obj.response.data;
          }
        }
      }
    },
    // 对公账户
    handleChange4({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      console.log("fileList", fileList);
      if (fileList.length == 0) {
        console.log("为空");
        this.fileList4 = fileList;
        this.form.setFieldsValue({
          upload4: " ",
        });
        console.log(this.fileList4);
      } else {
        this.fileList4 = fileList;
        let obj = fileList[0];
        if (obj.response) {
          console.log(obj.response.data);
          this.uploadImg.logMerchantPospUpdateRequest.publicAccount =
            obj.response.data;
        }
      }
    },
    handleChange5({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      console.log("fileList", fileList);
      this.fileList5 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logBankCard.imgCardno = obj.response.data;
          }
        }
      }
    },
    handleChange6({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList6 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logBankCard.imgTrack = obj.response.data;
          }
        }
      }
    },
    handleChange7({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList7 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.doorImg =
              obj.response.data;
          }
        }
      }
    },
    handleChange8({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList8 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.deskImg =
              obj.response.data;
          }
        }
      }
    },
    handleChange9({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList9 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.officeImg =
              obj.response.data;
          }
        }
      }
    },
    handleChange10({ file, fileList }) {
      // let pos = file.name.lastIndexOf(".");
      // let lastName = file.name.substring(pos, file.name.length);
      // let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      // if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
      //   this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
      //   return;
      // }
      // if (file.size / (1024 * 1024) > this.imageSize) {
      //   this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
      //   return;
      // }
      if (file.size / (1024 * 1024) > 50) {
        this.$message.error("上传文件大小应小于50Mb！");
        return;
      }
      this.fileList10 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      // if (obj) {
      //   if (obj.response) {
      //     console.log(obj.response);
      //     if (obj.response.code == "OK") {
      //       console.log(obj.response.data);
      //       // this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImg = obj.response.data;
      //       this.uploadImg.logMerchantPospUpdateRequest.merchantProtocolImgs.push(
      //         obj.response.data
      //       );
      //     }
      //   }
      // }
    },
    handleChange11({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList11 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.entrustRecharImg =
              obj.response.data;
          } else {
            this.uploadImg.logMerchantPospUpdateRequest.entrustRecharImg = "";
          }
        }
      }
    },
    handleChange12({ file, fileList }) {
      // let pos = file.name.lastIndexOf(".");
      // let lastName = file.name.substring(pos, file.name.length);
      // let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      // if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
      //   this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
      //   return;
      // }
      // if (file.size / (1024 * 1024) > this.imageSize) {
      //   this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
      //   return;
      // }
      if (file.size / (1024 * 1024) > 50) {
        this.$message.error("上传文件大小应小于50Mb！");
        return;
      }
      this.fileList12 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      // if (obj) {
      //   if (obj.response) {
      //     if (obj.response.code == "OK") {
      //       console.log(obj.response.data);
      //       this.uploadImg.logMerchantPospUpdateRequest.otherImgs.push(
      //         obj.response.data
      //       );
      //     }
      //   }
      // }
    },
    handleChange13({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList13 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.authLogIdentity.imgHead = obj.response.data;
          } else {
            this.uploadImg.authLogIdentity.imgHead = "";
          }
        }
      }
    },
    handleChange14({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList14 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.authLogIdentity.imgEmblem = obj.response.data;
          } else {
            this.uploadImg.authLogIdentity.imgEmblem = "";
          }
        }
      }
    },
    handleChange15({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList15 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.authLogIdentity.imgExt1 = obj.response.data;
          } else {
            this.uploadImg.authLogIdentity.imgExt1 = "";
          }
        }
      }
    },
    handleChange16({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList16 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.kinshipCertificateImg =
              obj.response.data;
          } else {
            this.uploadImg.logMerchantPospUpdateRequest.kinshipCertificateImg =
              "";
          }
        }
      }
    },
    handleChange17({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList17 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.logMerchantPospUpdateRequest.handCardImg =
              obj.response.data;
          } else {
            this.uploadImg.logMerchantPospUpdateRequest.handCardImg = "";
          }
        }
      }
    },
    handleChange18({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList18 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.cardHolderIdentity.imgHead = obj.response.data;
          } else {
            this.uploadImg.cardHolderIdentity.imgHead = "";
          }
        }
      }
    },
    handleChange19({ file, fileList }) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpeg、 png、 pdf 格式！");
        return;
      }
      if (file.size / (1024 * 1024) > this.imageSize) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
        return;
      }
      this.fileList19 = fileList;
      let obj =
        fileList.length > 0
          ? fileList[0]
          : { response: { data: null, code: null } };
      if (obj) {
        if (obj.response) {
          if (obj.response.code == "OK") {
            console.log(obj.response.data);
            this.uploadImg.cardHolderIdentity.imgEmblem = obj.response.data;
          } else {
            this.uploadImg.cardHolderIdentity.imgEmblem = "";
          }
        }
      }
    },
    beforeUpload(file) {
      let pos = file.name.lastIndexOf(".");
      let lastName = file.name.substring(pos, file.name.length);
      let supportTypes = [".jpeg", ".png", ".jpg", ".pdf"]; // jpeg、 png
      if (supportTypes.indexOf(lastName.toLowerCase()) <= -1) {
        this.$message.error("上传文件仅支持 jpg、 png 2种格式！");
        return;
      }
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isLt2M) {
        this.$message.error(`上传文件大小应小于${this.imageSize}Mb`);
      }
      return isLt2M;
    },
    doNext(step) {
      var st = step + 1;
      this.$router.replace("/OrgRegister/otherDataA/step" + st);
    },
    handleCancel() {
      this.previewVisible = false;
    },
    handleCancel2() {
      this.previewVisible2 = false;
    },
    handleCancel3() {
      this.previewVisible3 = false;
    },
    handleCancel4() {
      this.previewVisible4 = false;
    },
    handleCancel5() {
      this.previewVisible5 = false;
    },
    handleCancel6() {
      this.previewVisible6 = false;
    },
    handleCancel7() {
      this.previewVisible7 = false;
    },
    handleCancel8() {
      this.previewVisible8 = false;
    },
    handleCancel9() {
      this.previewVisible9 = false;
    },
    handleCancel10() {
      this.previewVisible10 = false;
    },
    handleCancel11() {
      this.previewVisible11 = false;
    },
    handleCancel12() {
      this.previewVisible12 = false;
    },
    handleCancel13() {
      this.previewVisible13 = false;
    },
    handleCancel14() {
      this.previewVisible14 = false;
    },
    handleCancel15() {
      this.previewVisible15 = false;
    },
    handleCancel16() {
      this.previewVisible16 = false;
    },
    handleCancel17() {
      this.previewVisible17 = false;
    },
    handleCancel18() {
      this.previewVisible18 = false;
    },
    handleCancel19() {
      this.previewVisible19 = false;
    },
    handlePreview(file) {
      console.log("file", file);
      this.previewImage = file.url || file.thumbUrl;
      this.previewVisible = true;
    },
    handlePreview2(file) {
      this.previewImage2 = file.url || file.thumbUrl;
      this.previewVisible2 = true;
    },
    handlePreview3(file) {
      this.previewImage3 = file.url || file.thumbUrl;
      this.previewVisible3 = true;
    },
    handlePreview4(file) {
      this.previewImage4 = file.url || file.thumbUrl;
      this.previewVisible4 = true;
    },
    handlePreview5(file) {
      this.previewImage5 = file.url || file.thumbUrl;
      this.previewVisible5 = true;
    },
    handlePreview6(file) {
      this.previewImage6 = file.url || file.thumbUrl;
      this.previewVisible6 = true;
    },
    handlePreview7(file) {
      this.previewImage7 = file.url || file.thumbUrl;
      this.previewVisible7 = true;
    },
    handlePreview8(file) {
      this.previewImage8 = file.url || file.thumbUrl;
      this.previewVisible8 = true;
    },
    handlePreview9(file) {
      this.previewImage9 = file.url || file.thumbUrl;
      this.previewVisible9 = true;
    },
    handlePreview10(file) {
      this.previewImage10 = file.url || file.thumbUrl;
      this.previewVisible10 = true;
    },
    handlePreview11(file) {
      this.previewImage11 = file.url || file.thumbUrl;
      this.previewVisible11 = true;
    },
    handlePreview12(file) {
      this.previewImage12 = file.url || file.thumbUrl;
      this.previewVisible12 = true;
    },
    handlePreview13(file) {
      this.previewImage13 = file.url || file.thumbUrl;
      this.previewVisible13 = true;
    },
    handlePreview14(file) {
      this.previewImage14 = file.url || file.thumbUrl;
      this.previewVisible14 = true;
    },
    handlePreview15(file) {
      this.previewImage15 = file.url || file.thumbUrl;
      this.previewVisible15 = true;
    },
    handlePreview16(file) {
      this.previewImage16 = file.url || file.thumbUrl;
      this.previewVisible16 = true;
    },
    handlePreview17(file) {
      this.previewImage17 = file.url || file.thumbUrl;
      this.previewVisible17 = true;
    },
    handlePreview18(file) {
      this.previewImage18 = file.url || file.thumbUrl;
      this.previewVisible18 = true;
    },
    handlePreview19(file) {
      this.previewImage19 = file.url || file.thumbUrl;
      this.previewVisible19 = true;
    },
    handleCancel() {
      this.previewVisible = false;
    },
    handleCancel2() {
      this.previewVisible2 = false;
    },
    handleCancel3() {
      this.previewVisible3 = false;
    },
    handleCancel4() {
      this.previewVisible4 = false;
    },
    handleCancel5() {
      this.previewVisible5 = false;
    },
    handleCancel6() {
      this.previewVisible6 = false;
    },
    handleCancel7() {
      this.previewVisible7 = false;
    },
    handleCancel8() {
      this.previewVisible8 = false;
    },
    handleCancel9() {
      this.previewVisible9 = false;
    },
    handleCancel10() {
      this.previewVisible10 = false;
    },
    handleCancel11() {
      this.previewVisible11 = false;
    },
    handleCancel12() {
      this.previewVisible12 = false;
    },
    handleCancel13() {
      this.previewVisible13 = false;
    },
    handleCancel14() {
      this.previewVisible14 = false;
    },
    handleCancel15() {
      this.previewVisible15 = false;
    },
    handleCancel16() {
      this.previewVisible16 = false;
    },
    handleCancel17() {
      this.previewVisible17 = false;
    },
    handleCancel18() {
      this.previewVisible18 = false;
    },
    handleCancel19() {
      this.previewVisible19 = false;
    },
    validateIdentityNo(rule, value, callback) {
      const form = this.form;
      if (value && !/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(value)) {
        callback("您输入的身份证号码格式有误！");
      } else {
        console.log("身份证号码！", value);
      }
      callback();
    },
    getDownload() {
      console.log("下载");
    },
    getFileDownload(value) {
      let data = value;
      api.getFilePath(
        data,
        (res) => {
          console.log(res);
          if (res.code == "OK") {
            const a = document.createElement("a");
            if (value == "merchant_service") {
              a.download = `特约商户服务协议.doc`;
            } else if (value == "entrust_income_auth") {
              a.download = `委托入款授权书.doc`;
            } else if (value == "entrust_auth") {
              a.download = `授权委托书.doc`;
            }
            let downloadUrl = "/file/file/download/" + res.data;
            a.href = downloadUrl;
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
          }
        },
        (err) => {
          console.log(err);
        }
      );
    },
  },
};
</script>

<style scoped>
.avatar-uploader {
  float: left;
}

.avatar-uploader > .ant-upload {
  width: 128px;
  height: 128px;
}

.ant-upload-select-picture-card i {
  font-size: 32px;
  color: #999;
}

.ant-upload-select-picture-card .ant-upload-text {
  margin-top: 8px;
  color: #666;
}

.c-center {
  text-align: center;
}

.submitButton {
  width: 8vw;
}

.formGroupTitle {
  font-size: 20px;
  font-weight: bold;
  text-align: right;
}

.row-sty {
  margin-bottom: 20px;
  margin-top: 20px;
}
</style>